import router from "@/router";
import store from "@/store";
import { Dialog } from "vant";

export const toProblem = () => {
  router.push("/problem");
};

//跳转意见反馈页面
export const toFeedback = () => {
  router.push("/feedback");
};

//跳转我的信息页面
export const toMsg = () => {
  router.push("/msg");
};

//跳转我的预约页面
export const toMine = () => {
  router.push("/mine");
};

//退出账号
export const goOut = async () => {
  try {
    await Dialog.confirm({
      showCancelButton: true,
      message: "确认退出？",
    });
    router.push("/login");
    // 退出时清除缓存
    localStorage.clear();
    // 清除state中的 数据
    store.commit("clear");
  } catch (err) {
    console.log(err);
  }
};
